package com.itheima.test;

import java.io.*;

class Student implements Serializable {
    private String name;
    private int age;
    public Student() {}
    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
    @Override
    public String toString() {
        return "Student{" +"name='" + name + '\'' +", age='" + age + '\'' + '}';
    }
}
public class Demo1 {
    public static void main(String[] args) throws Exception {
        Student s = new Student("张三",23);
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("a.txt"));
        Object o = ois.readObject();
        System.out.println(o);
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("day13_字符流\\a.txt"));
        oos.writeObject(s);
        oos.close();
    }
}
